package dyyx;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

import dyyx.servlet.HelloServlet;


@SpringBootApplication
// 使用内嵌容器 ，需要开启 Servlet 组件扫描
@ServletComponentScan
public class App {

	public static void main(String[] args) throws Exception {
		SpringApplication.run(App.class, args);
	}
	
	@Bean
	public ServletRegistrationBean registerHelloServlet() {
		
	    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new HelloServlet(), "/hello");
	    servletRegistrationBean.addInitParameter("name", "dyyx");
	   
	    return servletRegistrationBean;
	}
}
